Stop optimization after n solutions

35 views
Skip to first unread message

Charlie Swan

unread,
Feb 22, 2025, 1:41:27 AMFeb 22
to MiniZinc
Hello!

I was wondering if there is a way to stop iterating on solutions with optimization problems after n solutions have been explored. In other words, I want:

-n <i>, --num-solutions <i>
Stop after reporting i solutions (only used with satisfaction problems).

but for optimization problems.


I'm trying to improve performance for my problem. I tried modeling the optimization problem instead as a satisfy problem with a constraint specifying a threshold for the value I care about, but the problem is that the threshold would depend on the input data and how it fits with the constraints, and so isn't known ahead of time (think bin packing - you wouldn't be able to know a good enough "fullness" for a bin until you see the objects you're fitting and the constraints of the bin).

I also tried using the solver time out and going with the best solution after x seconds, but the problem there is that solving will then always take x seconds, even if I would have found a good enough solution in milliseconds.


I would appreciate any help or guidance! I read through all the Minizinc CLI options, and I've done a lot of googling, but haven't been able to find an answer. For what it's worth, I'm using chuffed as my solver, and I also tried researching if this is something chuffed supplies an option for.


Thank you!

Message has been deleted

vdi...@gmail.com

unread,
Feb 22, 2025, 2:11:39 PMFeb 22
to MiniZinc
In this way you only get a guess, but you never know how good it is. You can try to send the output to a file and watch the the timestamp of that file. If it does not change you abort minizinc. You obtain a hopefully good guess. Maybe you update your model with a constraint that says that the result should be better than the obtained guess.

Op vrijdag 21 februari 2025 om 21:11:27 UTC+1 schreef Charlie Swan:
Reply all
Reply to author
Forward
0 new messages